﻿using RFID.Model;
using RFID.VModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RFID.BLL
{
    public class GoodsInfoBLL
    {
        /// <summary>
        /// 查询一卡通
        /// </summary>
        /// <param name="key">卡号或学号</param>
        /// <returns>一卡通列表</returns>
        public static List<GoodsInfoView> Select(string key = "")
        {
            using (RFIDDataContext db = new RFIDDataContext())
            {
                return db.GoodsInfo.Where(p => string.IsNullOrEmpty(key) || p.Name.Contains(key)).Select(p => new GoodsInfoView() { 编号 = p.Id, 价格 = p.Price, 菜名 = p.Name }).ToList();
            }
        }
    }
}
